package cn.assumejson.springframework.beans.factory.annotation;

import cn.assumejson.springframework.context.stereotype.Component;

import java.util.Random;

/**
 * @author Mr. Li
 * @version 1.0
 * @since 1.0 2021/12/3 12:03
 */
@Component
public class UserService implements IUserService {

    @Value("${token}")
    private String token;

    @Autowired
    private UserDao userDao;

    public String queryUserInfo() {
        try {
            Thread.sleep(new Random(1).nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userDao.queryUserName("10002") + "，" + token;
    }

    @Override
    public String register(String userName) {
        try {
            Thread.sleep(new Random(1).nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "注册用户：" + userName + " success！";
    }

}
